import request from '@/utils/request'

export function loginByUsername(identifier,credential,loginType) {
  const data = {
    credential,
    identifier,
    loginType
  }
  return request({
    url: '/upms/signin',
    method: 'post',
    data
  })
}
// export function loginByUsername(data) {
//   return request({
//     url: '/upms/signin',
//     method: 'post',
//     data
//   })
// }

export function login (data) {
  return request({
    url: '/upms/signin',
    method: 'post',
    data
  })
}
export function logout() {
  return request({
    url: '/login/logout',
    method: 'post'
  })
}

export function getUserInfo (token) {
  return request({
    url: '/upms/emp/menus',
    method: 'get',
    // params: { token }
  })
}

export function getImgCode (t) { //获取图片验证码
  let data = {
    t : t
  }
  return request({
    url : '/upms/captcha',
    method : 'get',
    data
  })
}
export function getNoteCode (data) {
  return request({
    url: '/upms/sms/verify',
    method: 'get',
    params:  data
  })
}
